<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$HTML = <<<EOP
<table><tr><td>this is a test</td></tr></table>
EOP;
$regex = "/<\/?\w+((\s+(\w|\w[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i";
preg_match($regex,$HTML,$match);
echo $match[1];
?>
